<template>
	<view class="content">
		<image class="img" :src="staticUrl + '/image/mine/recharge/img_paySuccess.png'" ></image>
		<text class="T1">支付成功</text>
		<text class="T2">您的剩余爱豆为{{aiDou}}个,感谢使用~</text>
		<image class="icon" :src="staticUrl + '/image/mine/recharge/img_know.png'" @click="know()"></image>
	</view>
</template>

<script>
	import * as api from '@/api/login';
	export default {
		data() {
			return {
				staticUrl:this.$config.StaticUrl,
				aiDou:0,
			}
		},
		onLoad() {
			this.getPurseInfo();
			uni.$emit('updatePurseInfo',{});
		},
		methods: {
			know(){
				uni.navigateBack({
					delta: 2
				});
			},
			// 获取钱包信息
			getPurseInfo(){
				let that = this;
				let userId = this.$store.state.userInfo.currentUser.userId;
				let data = {
				  userId: userId,
				  action: "getPurseInfo",
				};
				api.getPurseInfo(data).then(function (res) {
					console.log('getPurseInfo::', res);
					if(res.data.code == 2000) {
						that.aiDou = res.data.data.userPurse;
					}
				}).catch(function (error) {
					console.log('getPurseInfo fail', error);
				})
			},
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.img{
		margin-top: 300rpx;
		width: 569rpx;
		height: 361rpx;
	}
	.T1{
		margin-top: 30rpx;
		font-size: 38rpx;
		font-family: Source Han Sans SC;
		font-weight: bold;
		color: #333333;
	}
	.T2{
		margin-top: 50rpx;
		font-size: 25rpx;
		font-family: Source Han Sans SC;
		font-weight: normal;
		color: #999999;
	}
	.icon{
		margin-top: 134rpx;
		width: 313rpx;
		height: 74rpx;
	}
</style>
